#include <iostream>
#include <stdio.h>
#include <cmath>
using namespace std;
typedef long long ll;
int main() {
	int T;
	ll ask;
	ll ans;
	cin>>T;
	while (T--) {
		cin>>ask;
		ans=sqrt((ask-1)/3);
		if (ans*(ans+1)*3+1==ask) {
			cout<<"YES"<<endl;
		}
		else {
			cout<<"NO"<<endl;
		}
	}
	return 0;
}
